use AppleShop
go
-- insert
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 32GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details1.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 32GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details2.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 32GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details3.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 32GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details4.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 32GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details5.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 32GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details6.jpg','...')

insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 64GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details1.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 64GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details2.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 64GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details3.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 64GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details4.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 64GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details5.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone4S 64GB World','~/IMG/iPhone/Iphone4S-16GB-World-Details6.jpg','...')

insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 16GB World','~/IMG/iPhone/Iphone5-32GB-World-Details1.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 16GB World','~/IMG/iPhone/Iphone5-32GB-World-Details2.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 16GB World','~/IMG/iPhone/Iphone5-32GB-World-Details3.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 16GB World','~/IMG/iPhone/Iphone5-32GB-World-Details4.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 16GB World','~/IMG/iPhone/Iphone5-32GB-World-Details5.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 16GB World','~/IMG/iPhone/Iphone5-32GB-World-Details6.jpg','...')

insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 64GB World','~/IMG/iPhone/Iphone5-32GB-World-Details1.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 64GB World','~/IMG/iPhone/Iphone5-32GB-World-Details2.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 64GB World','~/IMG/iPhone/Iphone5-32GB-World-Details3.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 64GB World','~/IMG/iPhone/Iphone5-32GB-World-Details4.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 64GB World','~/IMG/iPhone/Iphone5-32GB-World-Details5.jpg','...')
insert into ProductDetails(DetailsID, DetailsImage, DetailsText) values('Iphone5 64GB World','~/IMG/iPhone/Iphone5-32GB-World-Details6.jpg','...')
-- procedure select Iphone 
go
create procedure spGetProductIphone
as
	begin
		select * from Product where ProductsID like '%Iphone%'
	end
go
-- procedure select IPhone Details
create procedure spGetProductIphoneDetails
@ID varchar(50)
as
	begin
		select * from ProductDetails where DetailsID = @ID
	end

-- procedure select Iphone by ProductsID
go
create procedure spGetProductIphoneByID
@ID varchar(50)
as
	begin
		select * from Product where ProductsID = @ID
	end
-- procedure select Iphone Details by Img
go
create procedure spGetProductIphoneDetailsByNo
@No int
as
	begin
		select * from ProductDetails where DetailsNo = @No
	end
-- procedure delete Iphone
go
create procedure spDeleteIphone
@ID varchar(50)
as
	begin
		Delete From Product Where ProductsID = @ID
	end
	
-- procedure delete Iphone Details
go
create procedure spDeleteIphoneDetails
@No int
as
	begin
		Delete From ProductDetails Where DetailsNo = @No
	end
	
-- procedure update Iphone
go
create procedure spUpdateProductIphone
@ID varchar(50),
@Name varchar(50),
@Price float,
@Image varchar(200)
as
	begin
		UPDATE Product SET ProductsName = @Name,ProductsPrice = @Price, ProductsImage = @Image Where ProductsID = @ID
	end
	
-- procedure update Iphone Details
go
create procedure spUpdateProductIphoneDetails
@No int,
@Image varchar(200) ,
@Text varchar(500)
as
	begin
		Update ProductDetails SET DetailsImage = @Image, DetailsText = @Text Where DetailsNo = @No
	end

--procedure insert Iphone Products
go
create procedure spAddnewIphoneProducts
@ID varchar(50),
@Name varchar(50),
@TypeName varchar(50),
@Price float,
@Image varchar(200)
as
	begin
		insert into Product(ProductsID, ProductsName, ProductsTypeName, ProductsPrice, ProductsImage) 
			values (@ID, @Name, @TypeName, @Price, @Image)
	end

-- procedure insert Iphone Details
go
create procedure spAddnewIphoneDetails
@ID varchar(50),
@Image varchar(200),
@Text varchar(500)
as
	begin
		insert into ProductDetails(DetailsID, DetailsImage, DetailsText) 
		values (@ID, @Image, @Text)
	end
